<?php
/* @var $this SlideshowController */
/* @var $model Slideshow */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'slideshow-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array('enctype' => 'multipart/form-data')
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'link'); ?>
		<?php echo $form->textArea($model,'link',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'link'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'content'); ?>
		<?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'content'); ?>
	</div>


	<div class="row">
		<?php echo $form->labelEx($model,'sort'); ?>
		<?php echo $form->textField($model,'sort'); ?>
		<?php echo $form->error($model,'sort'); ?>
	</div>

  <div class="row">
     <?php echo $form->labelEx($model,'enabled'); ?>
     <?php echo $form->radioButtonList($model, 'enabled', array('1' => Yii::t('default', 'Có'), '0' => Yii::t('default', 'Không')), array('separator'=>'', 'template'=>' {input} {label} ')); ?>
  </div>

  <div class="row">
  <?php echo $form->labelEx($model, Yii::t('default', 'Chọn ảnh')); ?>
  <?php
  $this->widget('CMultiFileUpload', array(
    'model'=>$model,
    'name' => 'Slideshow[image]',
    'accept'=>'jpeg|jpg|gif|png',
    'denied'=>yii::t('default', 'Loại file được phép upload').': jpg, jpeg, gif, png.',
    'max'=>-1,
    'duplicate'=>Yii::t('default', 'Duplicated file!'),
    'remove'=>'[x] ',
    'options'=>array( 
  )
  ));
  ?>

  <?php if(!$model->isNewRecord && !empty($image)) {?>
    <div class="clearfix">
    <?php foreach ($image as $item) { ?>
      <div class="MultiFile-label" id="file_<?php echo $item['id']?>">
        <a href="javascript: void(0)"
          onclick="DeleteImage('<?php echo $item['id']?>')"><i
          class="icon-remove"></i> </a>
          <?php echo CHtml::link($item['name'], Yii::app()->baseUrl . '/upload/slideshow/' . $item['save'], array('target' => '_blank')); ?>
      </div>
      <?php } ?>
    </div>
    <?php }?>
    <p class="note">
    <?php echo yii::t('default', 'Loại file được phép upload')?>
      : jpg, jpeg, gif, png.
    </p>
  </div>
  
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->